package sk.tuke.homescreen;

import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.util.Log;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Ing. Tibor Fecko on 31.3.2014.
 */
public class AppInfoHolder  {


    private static String TAG =  "AppInfoHolder";
    private List<ApplicationInfo> mInfosList = null;

    public AppInfoHolder(PackageManager mPackageManager_in){
        this. mInfosList = new ArrayList<ApplicationInfo>();
        for(ApplicationInfo mInfo : mPackageManager_in.getInstalledApplications(0)){
            Log.d(TAG, "Found app: " + mInfo.loadLabel(mPackageManager_in));
            Log.d(TAG, "Pack: " + mInfo.packageName);
            if (mPackageManager_in.getLaunchIntentForPackage(mInfo.packageName) != null) {
                mInfosList.add(mInfo);
            }
        }
    }

    public List<ApplicationInfo> GetInfos(){
        return this.mInfosList;
    }

}